import { Controller, Post, Body, Get, Query } from '@nestjs/common';
import { ApiOperation } from '@nestjs/swagger';
import { LogService } from './log.service';
import { CreateLogDto } from './dto/create-log.dto';
import { FindAllDto } from './dto/update-log.dto';
import { LogOperationTitle } from 'src/common/decorator/oprertionlog.decorator';
import { Permissions } from '../public/public.decorator';

@Controller('log')
export class LogController {
  constructor(private readonly logService: LogService) {}

  @Post()
  create(@Body() createLogDto: CreateLogDto) {
    return createLogDto;
  }

  @Get()
  @LogOperationTitle('获取操作日志列表')
  @Permissions('read')
  @ApiOperation({ summary: '获取操作日志列表' })
  findAll(@Query() query: FindAllDto) {
    return this.logService.getOperationLogList(query);
  }
}
